package frontend.parser.node.expnode;

import frontend.lexer.token.TokenType;
import frontend.parser.node.Node;
import frontend.parser.node.TokenNode;

public class UnaryOp extends Node {
    private TokenType operator;
    private Type type;
    public void addOpTokenNode(TokenNode tokenNode) {
        super.add(tokenNode);
        this.operator = tokenNode.getToken().getTokenType();
        switch (operator) {
            case PLUS -> this.type = Type.PLUS;
            case MINU -> this.type = Type.MINU;
            case NOT -> this.type = Type.NOT;
            default -> {}
        }
    }

    public TokenType getOperator() {
        return operator;
    }

    public Type getType() {
        return type;
    }

    public enum Type {
        PLUS, MINU, NOT;
    }
}
